import dayjs from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import { RegDateYYYYMMDD } from "../data/reg";
dayjs.extend(customParseFormat);
export default (date: string, ftm: string = "YYYY-MM-DD") => {
  if (!RegDateYYYYMMDD.test(date)) {
    date = dayjs(new Date()).format(ftm);
  }
  return dayjs(date, ftm);
};
